<template>
    <view class="container" v-show="show" :style="themeColor">
        <header-bar :config="config"></header-bar>
        <view class="order-info">
            <view class="result-status" v-if="!from">
                <image src="/static/icon/success.png" class="success-icon" mode="widthFix"></image>
                <view class="tip">订单提交成功，请及时支付</view>
            </view>
            <view class="ought-price">
                <view><text>￥</text>{{ order.PayMoney - discountsPrice }}</view>
                <text>{{ order.ArrearsPrice == order.PriceSum ? "应付" : "待付" }}金额</text>
            </view>
            <view v-if="data.IsBatchPay">
                <view class="balance" v-if="balanceTrue">
                    <view class="balance-title">
                        <image src="/static/img/bank/yepay.png" mode=""></image>
                        {{ yepayItem && yepayItem.PayName ? yepayItem.PayName : "余额支付" }}
                    </view>
                    <view class="balance-body">
                        <view class="balance-body-check" @click="checkedpay">
                            <view>账户余额（余额：￥{{ data.UserBalance }}）</view>
                            <view class="checkmain"
                                :class="(checkedpaynum == 1 && data.UserBalance > 0) ? 'checkbox-active' : ''">
                                <image v-if="checkedpaynum == 1" src="/static/img/checked.png" mode=""></image>
                            </view>
                        </view>
                        <view class="balance-body-check balance-input">
                            <view>本次支付金额</view>
                            <view style="display: flex; align-items: center; color: #000; font-weight: bold">￥
                                <view class="inputbox" v-if="isFocus == false" @click="pitch">{{ yepay }}</view>
                                <input v-else type="digit" :focus="isFocus" :selection-start="selectionStart"
                                    :disabled="data.UserBalance == 0" :selection-end="selectionEnd" @blur="yepayto2"
                                    @input="change" v-model="yepay" />
                                <!-- :disabled="true" -->
                            </view>
                        </view>
                    </view>
                </view>
                <view class="balance">
                    <view class="balance-title balance-title-Still" :class="{ 'no-change-price': !data.IsPartialPay }">
                        <view class="still">
                            <view class="still-title">
                                <image src="/static/img/bank/hxpay.png" mode=""></image>还需支付
                            </view>
                            <view>￥{{ checkedpaynum == 2 ? order.PayMoney : yepay ? otherTotal : order.PayMoney }}
                            </view>
                        </view>
                        <view class="balance-body-check balance-input" v-if="data.IsPartialPay">
                            <view>本次支付金额</view>
                            <view style="display: flex; align-items: center; color: #000">￥<input type="digit"
                                    @blur="otherPriceto2" @input="otherchange" v-model="otherPrice" /></view>
                        </view>
                    </view>
                    <view class="playlist">
                        <view class="playtype" v-for="(item, index) in paylist" :key="index"
                            @click="paychange(item.PaymentPayWay, 0, item)">
                            <image class="pay-type-icon" :src="getPayTypeIcon(item)"></image>
                            <view class="pay-type-name" v-if="item.PaymentPayWay == 10">{{ item.PayName
                                }}<text>（信用额度：{{
                                    data.CreditLimit > 1000000000 ? "不限" : "￥" + data.CreditLimit
                                }}）</text></view>
                            <view class="pay-type-name" v-else>{{ item.PayName }}<text class="pay-type-discounts"
                                    v-if="item.DiscountMoney > 0 && checkedpaynum != 1">最高可优惠{{ item.DiscountMoney
                                    }}元</text>
                            </view>
                            <view class="radio" :class="payactive == item.PaymentPayWay ? 'active_radio' : ''">
                                <text></text>
                            </view>
                        </view>
                    </view>
                    <view class="playlist playlist-offline" v-if="offlinePay">
                        <view class="playtype">
                            <image class="pay-type-icon" :src="getPayTypeIcon(offlinePay)"></image>
                            <view class="pay-type-name">{{ offlinePay.PayName }}</view>
                        </view>
                        <view class="offline-pay">
                            <view class="offline-pay-item" v-for="(item, index) in bankList" :key="index"
                                @click="selectOfflineAccount(item)">
                                <image class="pay-type-icon" :src="getOfflinePayTypeIcon(item.AccountType)"></image>
                                <view class="pay-type-name">{{
                                    item.CustomName ? item.CustomName : item.AccountTypeName
                                }}</view>
                                <view class="radio"
                                    :class="{ active_radio: useOfflineAccount && useOfflineAccount.ID == item.ID }">
                                    <text></text>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
            <view class="balance" v-else>
                <view class="playlist">
                    <view class="playtype" v-for="(item, index) in pullpaylist" :key="index"
                        @click="paychange(item.PaymentPayWay, 1, item)">
                        <image class="pay-type-icon" :src="getPayTypeIcon(item)"></image>
                        <view class="pay-type-name">{{ item.PayName }}
                            <text v-if="item.PaymentPayWay == 10">（信用额度：{{ data.CreditLimit > 1000000000 ? "不限" : "￥" +
                                data.CreditLimit }}）</text>
                            <text v-if="item.PaymentPayWay == 1">（账户余额：￥{{ data.UserBalance }}）</text>
                            <text class="pay-type-discounts" v-if="item.DiscountMoney > 0 && checkedpaynum != 1">最高可优惠{{
                                item.DiscountMoney }}元</text>
                        </view>
                        <view class="radio" :class="payactive == item.PaymentPayWay ? 'active_radio' : ''"><text></text>
                        </view>
                    </view>
                </view>
                <view class="playlist playlist-offline" v-if="offlinePay">
                    <view class="playtype">
                        <image class="pay-type-icon" :src="getPayTypeIcon(offlinePay)"></image>
                        <view class="pay-type-name">{{ offlinePay.PayName }}</view>
                    </view>
                    <view class="offline-pay">
                        <view class="offline-pay-item" v-for="(item, index) in bankList" :key="index"
                            @click="selectOfflineAccount(item)">
                            <image class="pay-type-icon" :src="getOfflinePayTypeIcon(item.AccountType)"></image>
                            <view class="pay-type-name">{{ item.AccountName }}</view>
                            <view class="radio"
                                :class="{ active_radio: useOfflineAccount && useOfflineAccount.ID == item.ID }">
                                <text></text>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
            <view class="footer">
                <button class="btn" @click="clickFn" :disabled="!data.IsAblePay || order.State == 7">
                    {{ order.State == 7 ? "订单审核中，待通过后付款" : "确认支付" }}
                </button>
            </view>
        </view>
        <uni-popup ref="authorizationTip" type="center" :animation="false">
            <view class="pop-return-box">
                <authorization-box @tipclose="tipclose"></authorization-box>
            </view>
        </uni-popup>
        <uni-popup ref="passwordBox" type="center">
            <password-box ref="password" :setPwd="setPwd" @check="CheckPayPassword" @close="closePassbox">
            </password-box>
        </uni-popup>
        <uni-popup ref="popReturnTip" type="center" :animation="false" :is-mask-click="false">
            <view class="pop-return-box">
                <view class="pop-return-title">
                    <text>提示</text>
                </view>
                <!-- <view class="pop-tip">选择其他付款方案，有获得<text style="color: red;font-size: 30rpx;font-weight: bold;">{{data.CreditPayAddMoney}}元</text>的优惠，您选择信用支付，本次优惠将会被取消。</view> -->
                <view class="pop-tip">选择其它付款方案，可享受优惠活动，您选择信用支付，本次优惠活动将会被取消。</view>
                <view class="pop-action">
                    <view @click="$refs.popReturnTip.close()">选择信用支付</view>
                    <view @click="$refs.popReturnTip.close()">其他方式支付</view>
                </view>
            </view>
        </uni-popup>

        <!-- 支付二维码 -->
        <uni-popup ref="qcodePopup" type="center">
            <qcode @onBack="onBack" :qcode="qcode" :name="codeName" :url_base64="url_base64" :Sn="order.Sn"
                :money="order.PayMoney - discountsPrice"></qcode>
        </uni-popup>
    </view>
</template>

<script>
import { GetPayOrderId, XianPayNew } from "@/service/api/order.js"
import { IsSetPayPassword, CheckPayPassword, GetCreditLimit } from "@/service/api/member.js"
import { GetMiniAppPayData, GetMiniAppId } from "@/service/api/weChat.js"
import { GetAppPayContent } from "@/service/api/ali.js"
import { MiniProgramPay, FuiouMiniAppPay } from "@/service/api/open.js"
import authorizationBox from "@/components/order/authorization-box.vue"
import passwordBox from "@/pages_shop/components/order/password-box.vue"
import storage from "@/uni-sub-base/utils/storage.js"
import configs from "@/config/config.js"
import { helPayFn } from "@/utils/orderUtil.js"
import qcode from "./qcode.vue"
export default {
    components: {
        authorizationBox,
        passwordBox,
        qcode
    },
    data() {
        return {
            // config: {
            //     title: "订单付款",
            //     back: true,
            // },
            config: {
                title: "订单付款",
                back: true,
                color: ["#333333"],
                centerSlot: true,
                barPlaceholder: true,
                // backgroundColor: [1, "#F7F9FB"],
            },
            full: 0,
            show: false,
            checkedpaynum: 1, //1 表示选择余额支付
            otherTotal: null,
            yepay: null,
            otherPrice: null,
            orderId: 0,
            data: {},
            order: {},
            payactive: -1,
            balanceTrue: false,
            paylist: [],
            pullpaylist: [],
            bankList: [],
            offlinePay: null,
            useOfflineAccount: null,//线下付款
            from: 0,
            state: "",
            yepayItem: null,
            isFocus: false,
            selectionStart: -1,
            selectionEnd: -1,
            isPayPwd: false, //是否设置了支付密码
            isPayPwdRight: false,
            needBalancePayPassword: true, //余额支付是否需要密码
            setPwd: true,
            payPassWord: "",
            formapp: 0,
            businessId: "",
            stateStatus: false,
            discountsPrice: 0,
            isTempCar: false,
            qcode: "",
            codeName: "微信",
            url_base64: "",
        }
    },
    computed: {},
    onLoad(e) {
        this.orderId = e.orderId
        if (e.from) {
            this.from = e.from
        }
        if (e.state) {
            this.state = e.state
        }
        if (e.formapp) {
            this.formapp = e.formapp
        }
        if (e.businessId) {
            this.businessId = e.businessId
        }
        //获取余额支付是否需要密码
        this.needBalancePayPassword = storage.getCache("webInfo").NeedBalancePayPassword
    },
    mounted() {
        this.getOrderDetail()
    },
    onShow() {
        this.IsSetPayPassword()
        this.$forceUpdate()
    },
    methods: {
        CheckPayPassword(pwd) {
            //验证支付密码
            let password = {
                password: pwd,
            }
            this.payPassWord = pwd
            CheckPayPassword(password).then((res) => {
                if (res.Data) {
                    this.isPayPwdRight = true
                    this.clickFn()
                } else {
                    this.$refs.password.delete()
                    this.isPayPwdRight = false
                    this.easyToast(res.Msg)
                }
            })
        },
        IsSetPayPassword() {
            //获取是否设置支付密码
            IsSetPayPassword().then((res) => {
                if (res.State == 1 && res.Data) {
                    if (res.Data == true) {
                        this.isPayPwd = true
                        this.setPwd = false
                    } else {
                        this.isPayPwd = false
                        this.setPwd = true
                    }
                }
            })
        },
        closePassbox() {
            //关闭支付密码框
            this.$refs.password.setFocus(1)
            wx.hideKeyboard()
            this.$refs.passwordBox.close()
            this.$forceUpdate()
        },
        //获取订单详情
        getOrderDetail() {
            let path = "?id=" + this.orderId + "&isXianXia=1"
            GetPayOrderId(path).then((res) => {
                if (res.State) {
                    this.data = res.Data
                    this.order = res.Data.Order
                    this.bankList = res.Data.BankList
                    let paylist = res.Data.PayList;
                    let arrPayWay = paylist.map(item => item.PayType);
                    paylist.forEach((e, index) => {
                        if (e.PayType == 13 && !arrPayWay.includes(53)) {
                            let newItem = {
                                "PayName": "支付宝扫码支付",
                                "PayType": 53,
                                "OrderBy": e.OrderBy + 1,
                                "IsDefault": 0,
                                "UsageScenario": "|0|1|2|3|6|",
                                "NeedUploadProof": 0,
                                "AccountCode": "扫码",
                                "PayTypeName": "支付宝扫码支付",
                                "UsageScenarioList": [
                                    "批发订货",
                                    "零售商城",
                                    "账户充值",
                                    "升级下单",
                                    "代客下单"
                                ],
                                "Balance": -1,
                                "IsOpenRecharge": 0,
                                "PayWay": 1,
                                "PaymentPayWay": 53,
                            }
                            paylist.splice(index + 1, 0, newItem)
                        }
                        if (e.PayType == 53) {
                            e.PaymentPayWay = 53
                        }
                        if (e.PayType == 13) {
                            e.PayName = "微信扫码支付"
                            e.PayTypeName = "微信扫码支付"
                        }
                    })
                    if (res.Data.UserBalance == 0) { // 余额为0
                        this.checkedpaynum = 2;
                    }

                    if (this.order.ArrearsPrice > 0) {
                        this.order.PayMoney = this.order.ArrearsPrice
                    }
                    paylist = paylist.filter((val) => {
                        if (val.PaymentPayWay != 21) {
                            return val
                        }
                    })
                    this.show = true
                    let credit = paylist.filter((val) => {
                        if (val.PaymentPayWay == 10) {
                            return val.PaymentPayWay
                        }
                    })
                    if (credit.length > 0) {
                        let webInfo = storage.getCache("webInfo")
                        let path = '?businessId=' + webInfo.BusinessId + '&userId=' + this.order.UserId
                        GetCreditLimit(path).then((sub) => {
                            if (sub.State == 1) {
                                this.data.CreditLimit = sub.Data;
                                paylist.forEach((e, index) => {
                                    //信用额度小于等于0 不显示
                                    if (e.PaymentPayWay == 10 && this.data.CreditLimit <= 0) {
                                        paylist.splice(index, 1)
                                    }
                                })
                            }
                        })
                    }

                    if (this.data.IsBatchPay) {
                        if (this.state != 0 && this.state != 12 && this.state != "") {
                            paylist.forEach((e, index) => {
                                //'货到付款'
                                if (e.PaymentPayWay == 11) {
                                    paylist.splice(index, 1)
                                }
                            })
                        }
                        paylist.forEach((e, index) => {
                            if (index == 0) {
                                this.payactive = e.PaymentPayWay
                            }
                            if (e.PaymentPayWay == 1) {
                                this.yepayItem = e
                                this.balanceTrue = true
                                paylist.splice(index, 1)
                            }
                        })

                        // #ifndef APP
                        paylist.forEach((e, index) => {
                            //支付宝支付
                            if (e.PaymentPayWay == 5) {
                                paylist.splice(index, 1)
                            }
                        })
                        // paylist.forEach((e, index) => {
                        //     //宝付微信
                        //     if (e.PaymentPayWay == 18) {
                        //         paylist.splice(index, 1)
                        //     }
                        // })
                        paylist.forEach((e, index) => {
                            //宝付微信支付宝
                            if (e.PaymentPayWay == 19) {
                                paylist.splice(index, 1)
                            }
                        })
                        // #endif
                        paylist.forEach((e, index) => {
                            //线下支付
                            if (e.PaymentPayWay == 0) {
                                this.offlinePay = e
                                paylist.splice(index, 1)
                            }
                        })

                        this.paylist = paylist
                    } else {
                        let pullpaylist = res.Data.PayList
                        if (this.state != 0 && this.state != 12 && this.state != "") {
                            pullpaylist.forEach((e, index) => {
                                if (e.PaymentPayWay == 11) {
                                    pullpaylist.splice(index, 1)
                                }
                            })
                        }

                        pullpaylist.forEach((e, index) => {
                            //线下支付
                            if (e.PaymentPayWay == 0) {
                                this.offlinePay = e
                                pullpaylist.splice(index, 1)
                            }
                        })
                        console.log('支付宝扫码支付', pullpaylist)

                        this.pullpaylist = pullpaylist
                    }
                    if (this.balanceTrue) {
                        if (this.data.UserBalance > this.order.PayMoney) {
                            this.yepay = this.order.PayMoney
                            this.change()
                        } else {
                            this.yepay = this.data.UserBalance
                            // this.yepay = this.order.PayMoney
                            this.change()
                        }
                        this.checkUpOtherPrice()
                    } else {
                        this.otherPrice = this.order.PayMoney
                    }
                } else {
                    this.easyToast(res.Msg)
                }
            })
        },
        change(key) {
            var that = this
            if (this.checkedpaynum == 1 && this.balanceTrue) {
                if (parseFloat(this.yepay) > parseFloat(this.order.PayMoney)) {
                    setTimeout(() => {
                        that.yepay = that.order.PayMoney
                        that.otherTotal = 0
                        that.otherPrice = 0
                        this.checkUpOtherPrice()
                    }, 0)
                } else {
                    that.otherTotal = (that.order.PayMoney - that.yepay).toFixed(2)
                    this.checkUpOtherPrice()
                }
            } else if (this.checkedpaynum == 2 && this.balanceTrue) { // wsw
                that.otherTotal = (that.order.PayMoney - that.yepay).toFixed(2)
                this.checkUpOtherPrice()
            }
        },
        checkUpOtherPrice() {
            if (!this.getAppSet().canChangePayMoney) {
                this.otherPrice = this.otherTotal
            }
        },
        pitch() {
            this.isFocus = true
            this.selectionStart = 0
            this.selectionEnd = this.yepay.toString().length
        },
        yepayto2() {
            if (this.yepay) {
                this.yepay = parseFloat(this.yepay).toFixed(2)
            }
            this.isFocus = false
            this.selectionStart = -1
            this.selectionEnd = -1
        },
        otherPriceto2() {
            if (this.otherPrice) {
                this.otherPrice = parseFloat(this.otherPrice).toFixed(2)
            }
        },
        otherchange(key) {
            var that = this
            if (this.checkedpaynum == 1 && this.balanceTrue) {
                if (parseFloat(this.otherPrice) > parseFloat(this.otherTotal)) {
                    setTimeout(() => {
                        that.otherPrice = that.otherTotal
                    }, 0)
                }
            } else {
                this.otherTotal = this.order.PayMoney
                if (parseFloat(this.otherPrice) > parseFloat(this.otherTotal)) {
                    setTimeout(() => {
                        that.otherPrice = that.otherTotal
                    }, 0)
                }
            }
        },
        paychange(id, num, item) {
            if (id == 10 && this.order.PayMoney > this.data.CreditLimit) {
                return
            }
            if (
                id == 10 &&
                (this.data.CreditPayAddMoney > 0 || this.data.CreditPayCancelGiff) &&
                this.payactive != id
            ) {
                this.$refs.popReturnTip.open()
            }
            this.full = num ? num : 0
            if (this.payactive != id) {
                this.payactive = id
            } else {
                this.payactive = -1
                this.discountsPrice = 0
            }
            if (id != 0) {
                this.useOfflineAccount = null
                this.$forceUpdate()
            }
            if (this.useOfflineAccount) {
                this.payactive = id
                this.discountsPrice = 0
            } else {
                if (this.payactive != -1 && this.checkedpaynum != 1) {
                    this.discountsPrice = item.DiscountMoney ? item.DiscountMoney : 0
                }
            }

        },
        selectOfflineAccount(item) {
            if (this.offlinePay) {
                if (this.useOfflineAccount && this.useOfflineAccount.ID == item.ID) {
                    this.useOfflineAccount = null
                    this.paychange(this.offlinePay.PaymentPayWay)
                } else {
                    this.useOfflineAccount = item
                    this.paychange(this.offlinePay.PaymentPayWay)
                }
            }
        },
        checkedpay() {
            if (this.data.UserBalance == 0) {
                return
            }
            var that = this;
            if (this.checkedpaynum != 1) {
                this.checkedpaynum = 1
                this.discountsPrice = 0
                if (parseFloat(this.yepay) > parseFloat(this.order.PayMoney)) {
                    setTimeout(() => {
                        that.yepay = that.order.PayMoney
                        that.otherTotal = 0
                        that.otherPrice = 0
                        this.checkUpOtherPrice()
                    }, 0)
                } else {
                    that.otherTotal = (that.order.PayMoney - that.yepay).toFixed(2)
                    that.otherPrice = 0
                    this.checkUpOtherPrice()
                }
            } else {
                this.checkedpaynum = 2
                that.otherTotal = that.order.PayMoney
                console.log("checkUpOtherPrice6")
                this.checkUpOtherPrice()
                this.paychange(this.payactive)
            }
        },
        tipclose() {
            this.$refs.authorizationTip.close()
        },
        clickFn() {
            var that = this
            let paths = "?id=" + this.orderId
            GetPayOrderId(paths).then((ress) => {
                if (ress.State) {
                    if (ress.Data.Order) {
                        this.order.Sn = ress.Data.Order.Sn
                        this.order.OutTradeNo = ress.Data.Order.OutTradeNo
                    }
                    if (ress.Data.Order.State == 11) {
                        this.easyToast("订单已取消，无法支付")
                        return
                    } else {
                        console.log("this.full ", this.full)
                        if (this.full == 0) {
                            if (this.checkedpaynum == 2 && this.payactive == -1) {
                                this.easyToast("请选择支付方式")
                            }
                            if (this.checkedpaynum == 1 && !this.yepay && this.balanceTrue) {
                                this.easyToast("请输入余额支付金额")
                            }
                            if (
                                this.checkedpaynum == 1 &&
                                this.yepay &&
                                (this.payactive == -1 || this.otherPrice == 0)
                            ) {
                                console.log("单单余额支付")
                                //单单余额支付
                                if (this.data.UserBalance > 0) {
                                    if (!this.getAppSet().canChangePayMoney && this.otherPrice > 0) {
                                        this.easyToast("请选择支付方式")
                                    } else {
                                        let parms = {
                                            orderId: this.orderId,
                                            payWay: 1,
                                            price: this.yepay,
                                        }

                                        if (this.needBalancePayPassword) {
                                            //是否需要密码
                                            if (this.isPayPwd) {
                                                //是否设置了密码
                                                if (this.isPayPwdRight) {
                                                    //是否密码正确
                                                    parms.payPassWord = this.payPassWord
                                                    this.synthesizepay(parms, 1)
                                                } else {
                                                    this.$refs.passwordBox.open()
                                                    this.$nextTick(() => {
                                                        this.$refs.password.setFocus()
                                                    })
                                                }
                                            } else {
                                                this.$refs.passwordBox.open()
                                                this.$nextTick(() => {
                                                    this.$refs.password.setFocus()
                                                })
                                            }
                                        } else {
                                            this.synthesizepay(parms)
                                        }
                                    }
                                } else {
                                    this.easyToast("账户余额不足")
                                }
                            }
                            console.log("this.otherPrice", this.otherPrice)
                            if (this.otherPrice == 0) {
                                //剩余金额为0拦截
                                return
                            }
                            if (this.payactive == -1 && !this.balanceTrue) {
                                this.easyToast("请选择支付方式")
                                return
                            }
                            if (this.payactive != -1) {
                                //其他支付
                                if (!this.otherPrice) {
                                    this.easyToast("请输入还需支付金额")
                                    return
                                }
                                if (this.checkedpaynum == 1 && this.yepay) {
                                    //余额支付
                                    let parms = {
                                        orderId: this.orderId,
                                        payWay: 1,
                                        price: this.yepay,
                                    }
                                    if (this.needBalancePayPassword) {
                                        //是否需要密码
                                        if (this.isPayPwd) {
                                            //是否设置了密码
                                            if (this.isPayPwdRight) {
                                                //是否密码正确
                                                parms.payPassWord = this.payPassWord
                                                this.synthesizepay(parms, 1)
                                            } else {
                                                this.$refs.passwordBox.open()
                                                this.$nextTick(() => {
                                                    this.$refs.password.setFocus()
                                                })
                                                return
                                            }
                                        } else {
                                            this.$refs.passwordBox.open()
                                            this.$nextTick(() => {
                                                this.$refs.password.setFocus()
                                            })
                                        }
                                    } else {
                                        if (this.yepay > 0) {
                                            XianPayNew(parms).then((res) => {
                                                if (res.State) {
                                                    if (this.payactive == 12) {
                                                        //同时进行云支付
                                                        this.helPayOrder(this.orderId)
                                                    }
                                                } else {
                                                    this.easyToast(res.Msg)
                                                }
                                            })
                                        }
                                    }
                                }
                                if (this.payactive == 10) {
                                    //信用额度支付
                                    if (this.data.CreditLimit > 0) {
                                        let parms = {
                                            orderId: this.orderId,
                                            payWay: 10,
                                            price: this.otherPrice + this.data.CreditPayAddMoney,
                                        }
                                        if (this.needBalancePayPassword) {
                                            //是否需要密码
                                            if (this.isPayPwd) {
                                                //是否设置了密码
                                                if (this.isPayPwdRight) {
                                                    //是否密码正确
                                                    parms.payPassWord = this.payPassWord
                                                    this.synthesizepay(parms, 1)
                                                } else {
                                                    this.$refs.passwordBox.open()
                                                    this.$nextTick(() => {
                                                        this.$refs.password.setFocus()
                                                    })
                                                }
                                            } else {
                                                this.$refs.passwordBox.open()
                                                this.$nextTick(() => {
                                                    this.$refs.password.setFocus()
                                                })
                                            }
                                        } else {
                                            this.synthesizepay(parms)
                                        }
                                    } else {
                                        this.easyToast("信用额度余额不足")
                                    }
                                }
                                if (this.payactive == 11) {
                                    //货到付款支付
                                    let parms = {
                                        orderId: this.orderId,
                                        payWay: 11,
                                        price: this.otherPrice,
                                    }
                                    this.synthesizepay(parms)
                                }
                                if (this.payactive == 0) {
                                    //线下支付
                                    this.easyGoTo(
                                        "/pages_shop/packet/order/waitPay?paynumber=" +
                                        this.otherPrice +
                                        "&orderId=" +
                                        this.orderId +
                                        "&accountId=" +
                                        this.useOfflineAccount.ID +
                                        "&from=1",
                                    )
                                }
                                if (this.payactive == 12) {
                                    //云支付
                                    let isUseYePay = this.checkedpaynum == 1 && this.yepay
                                    //是否同时进行余额支付
                                    if (!isUseYePay) {
                                        this.helPayOrder(this.orderId)
                                    }
                                }
                                if (this.payactive == 5 || this.payactive == 19) {
                                    //支付宝支付
                                    let webInfo = storage.getCache("webInfo")
                                    let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                    let payParam = {
                                        tip: "订单支付",
                                        orderSn: this.order.Sn,
                                        paySn: this.order.OutTradeNo,
                                        money: this.otherPrice,
                                        notifyUrl: notify_url,
                                        payWay: this.payactive
                                    }
                                    GetAppPayContent(payParam).then((payRes) => {
                                        if (payRes.State == 1) {
                                            uni.requestPayment({
                                                provider: "alipay",
                                                orderInfo: payRes.Data,
                                                success: function (res) {
                                                    uni.hideLoading()
                                                    that.easyReLaunch(
                                                        "/pages_shop/packet/order/payResult?orderId=" +
                                                        that.orderId +
                                                        "&formapp=" +
                                                        that.formapp,
                                                    )
                                                },
                                                fail: function (err) {
                                                    uni.hideLoading()
                                                    // that.getOrderDetail()
                                                    that.goOrderPage()
                                                },
                                            })
                                        } else {
                                            this.easyToast(payRes.Msg)
                                        }
                                    })
                                }

                                // 微信扫码支付
                                if (this.payactive == 13) {
                                    this.codeName = "微信";
                                    let webInfo = storage.getCache("webInfo")
                                    let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                    let tip = "订单支付"
                                    let payParam = {
                                        tip: tip,
                                        orderSn: this.order.Sn,
                                        paySn: this.order.OutTradeNo,
                                        money: this.otherPrice - this.discountsPrice,
                                        notifyUrl: notify_url,
                                        payWay: this.payactive,
                                        businessId: webInfo.BusinessId,
                                        type: 2, // 微信扫码支付
                                    }
                                    uni.showLoading({
                                        title: "付款中..",
                                        mask: true,
                                    })
                                    that.fuiouPay(payParam)
                                }
                                // 支付宝扫码支付
                                if (this.payactive == 53) {
                                    this.codeName = "支付宝";
                                    let webInfo = storage.getCache("webInfo")
                                    let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                    let tip = "订单支付"
                                    let payParam = {
                                        tip: tip,
                                        orderSn: this.order.Sn,
                                        paySn: this.order.OutTradeNo,
                                        money: this.otherPrice - this.discountsPrice,
                                        notifyUrl: notify_url,
                                        payWay: 13,
                                        businessId: webInfo.BusinessId,
                                        type: 1, // 支付宝扫码支付
                                    }
                                    uni.showLoading({
                                        title: "付款中..",
                                        mask: true,
                                    })
                                    that.fuiouPay(payParam)
                                }

                                if (
                                    this.payactive == 4 ||
                                    this.payactive == 7 ||
                                    this.payactive == 14 ||
                                    this.payactive == 17 ||
                                    this.payactive == 18 ||
                                    this.payactive == 99 ||
                                    this.payactive == 8
                                ) {
                                    //微信支付 && 富友支付
                                    let webInfo = storage.getCache("webInfo")
                                    //#ifdef APP-PLUS
                                    if (this.payactive == 18) {
                                        //app跳转宝付支付小程序
                                        let openId = storage.getCache("openId");
                                        if (openId) {
                                            let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                            let tip = "订单支付"
                                            let payParam = {
                                                tip: tip,
                                                orderSn: this.order.Sn,
                                                paySn: this.order.OutTradeNo,
                                                money: this.otherPrice - this.discountsPrice,
                                                notifyUrl: notify_url,
                                                payWay: this.payactive,
                                                businessId: webInfo.BusinessId,
                                                openId: openId,
                                            }
                                            uni.showLoading({
                                                title: "付款中..",
                                                mask: true,
                                            })

                                            that.fuiouAppPay(payParam)
                                        } else {
                                            that.Applogin();
                                        }

                                    } else {
                                        let appidx = "?appIdx=1"
                                        let path =
                                            "pages_shop/packet/order/appGoMiniwaitPay?orderId=" +
                                            this.orderId +
                                            "&formapp=1&businessId=" +
                                            webInfo.BusinessId +
                                            "&payWay=" +
                                            this.payactive +
                                            "&discountsPrice=" + this.discountsPrice
                                        console.log(path)
                                        GetMiniAppId(appidx).then((rsp) => {
                                            console.log(rsp)
                                            if (rsp.State == 1) {
                                                if (rsp.Data.ChatId) {
                                                    this.openMiniProgram(path, rsp.Data.ChatId)
                                                } else {
                                                    this.openMiniProgram(path)
                                                }
                                                setTimeout(() => {
                                                    uni.reLaunch({
                                                        url: "/pages/login/loading",
                                                    })
                                                    storage.setCache("miniProgram", true)
                                                }, 1000)
                                            } else {
                                                this.easyToast(rsp.Msg)
                                            }
                                        })
                                    }

                                    //#endif
                                    //#ifdef MP-WEIXIN
                                    let openId = storage.getCache("openId")
                                    if (openId) {
                                        let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                        let tip = "订单支付"
                                        let payParam = {
                                            tip: tip,
                                            orderSn: this.order.Sn,
                                            paySn: this.order.OutTradeNo,
                                            money: this.otherPrice - this.discountsPrice,
                                            notifyUrl: notify_url,
                                            payWay: this.payactive,
                                            businessId: webInfo.BusinessId,
                                            openId: openId,
                                        }
                                        uni.showLoading({
                                            title: "付款中..",
                                            mask: true,
                                        })

                                        that.fuiouPay(payParam)
                                    } else {
                                        this.$refs.authorizationTip.open()
                                    }
                                    //#endif
                                }

                            }
                        } else {
                            if (this.payactive == 10) {
                                //信用额度支付
                                if (this.data.CreditLimit > 0) {
                                    let parms = {
                                        orderId: this.orderId,
                                        payWay: 10,
                                        price: this.order.PayMoney + this.data.CreditPayAddMoney,
                                    }
                                    if (this.needBalancePayPassword) {
                                        //是否需要密码
                                        if (this.isPayPwd) {
                                            //是否设置了密码
                                            if (this.isPayPwdRight) {
                                                //是否密码正确
                                                parms.payPassWord = this.payPassWord
                                                this.synthesizepay(parms, 1)
                                            } else {
                                                this.$refs.passwordBox.open()
                                                this.$nextTick(() => {
                                                    this.$refs.password.setFocus()
                                                })
                                            }
                                        } else {
                                            this.$refs.passwordBox.open()
                                            this.$nextTick(() => {
                                                this.$refs.password.setFocus()
                                            })
                                        }
                                    } else {
                                        this.synthesizepay(parms)
                                    }
                                } else {
                                    this.easyToast("信用额度余额不足")
                                }
                            }
                            if (this.payactive == 1) {
                                //余额支付
                                if (this.data.UserBalance > 0) {
                                    let parms = {
                                        orderId: this.orderId,
                                        payWay: 1,
                                        price: this.order.PayMoney,
                                    }
                                    if (this.needBalancePayPassword) {
                                        //是否需要密码
                                        if (this.isPayPwd) {
                                            //是否设置了密码
                                            if (this.isPayPwdRight) {
                                                //是否密码正确
                                                parms.payPassWord = this.payPassWord
                                                this.synthesizepay(parms, 1)
                                            } else {
                                                this.$refs.passwordBox.open()
                                                this.$nextTick(() => {
                                                    this.$refs.password.setFocus()
                                                })
                                            }
                                        } else {
                                            this.$refs.passwordBox.open()
                                            this.$nextTick(() => {
                                                this.$refs.password.setFocus()
                                            })
                                        }
                                    } else {
                                        this.synthesizepay(parms)
                                    }
                                } else {
                                    this.easyToast("账户余额不足")
                                }
                            }
                            if (this.payactive == 11) {
                                //货到付款支付
                                let parms = {
                                    orderId: this.orderId,
                                    payWay: 11,
                                    price: this.otherPrice,
                                }
                                this.synthesizepay(parms)
                            }
                            if (this.payactive == 0) {
                                //线下支付
                                this.easyGoTo(
                                    "/pages_shop/packet/order/waitPay?paynumber=" +
                                    this.order.PayMoney +
                                    "&orderId=" +
                                    this.orderId +
                                    "&accountId=" +
                                    this.useOfflineAccount.ID +
                                    "&from=0",
                                )
                            }
                            if (this.payactive == 12) {
                                //云支付
                                this.helPayOrder(this.orderId)
                            }
                            if (this.payactive == 5 || this.payactive == 19) {
                                //支付宝支付
                                let webInfo = storage.getCache("webInfo")
                                let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                let payParam = {
                                    tip: "订单支付",
                                    orderSn: this.order.Sn,
                                    paySn: this.order.OutTradeNo,
                                    money: this.otherPrice,
                                    notifyUrl: notify_url,
                                    payWay: this.payactive,
                                }
                                GetAppPayContent(payParam).then((payRes) => {
                                    if (payRes.State == 1) {
                                        uni.requestPayment({
                                            provider: "alipay",
                                            orderInfo: payRes.Data,
                                            success: function (res) {
                                                uni.hideLoading()
                                                that.easyReLaunch(
                                                    "/pages_shop/packet/order/payResult?orderId=" +
                                                    that.orderId +
                                                    "&formapp=" +
                                                    that.formapp,
                                                )
                                            },
                                            fail: function (err) {
                                                uni.hideLoading()
                                                // that.getOrderDetail()
                                                that.goOrderPage()
                                            },
                                        })
                                    } else {
                                        this.easyToast(payRes.Msg)
                                    }
                                })
                            }

                            // 微信扫码支付
                            if (this.payactive == 13) {
                                this.codeName = "微信";
                                let webInfo = storage.getCache("webInfo")
                                let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                let tip = "订单支付"
                                let payParam = {
                                    tip: tip,
                                    orderSn: this.order.Sn,
                                    paySn: this.order.OutTradeNo,
                                    money: this.otherPrice - this.discountsPrice,
                                    notifyUrl: notify_url,
                                    payWay: this.payactive,
                                    businessId: webInfo.BusinessId,
                                    type: 2, // 微信扫码支付
                                }
                                uni.showLoading({
                                    title: "付款中..",
                                    mask: true,
                                })
                                that.fuiouPay(payParam)
                            }
                            // 支付宝扫码支付
                            if (this.payactive == 53) {
                                this.codeName = "支付宝";
                                let webInfo = storage.getCache("webInfo")
                                let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                let tip = "订单支付"
                                let payParam = {
                                    tip: tip,
                                    orderSn: this.order.Sn,
                                    paySn: this.order.OutTradeNo,
                                    money: this.otherPrice - this.discountsPrice,
                                    notifyUrl: notify_url,
                                    payWay: 13,
                                    businessId: webInfo.BusinessId,
                                    type: 1,  // 支付宝扫码支付
                                }
                                uni.showLoading({
                                    title: "付款中..",
                                    mask: true,
                                })
                                that.fuiouPay(payParam)
                            }

                            if (
                                this.payactive == 4 ||
                                this.payactive == 7 ||
                                this.payactive == 17 ||
                                this.payactive == 18 ||
                                this.payactive == 14 ||
                                this.payactive == 8
                            ) {
                                //微信支付
                                let webInfo = storage.getCache("webInfo")
                                //#ifdef APP-PLUS
                                if (this.payactive == 18) {
                                    //app跳转宝付支付小程序
                                    let openId = storage.getCache("openId");
                                    if (openId) {
                                        let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                        let tip = "订单支付"
                                        let payParam = {
                                            tip: tip,
                                            orderSn: this.order.Sn,
                                            paySn: this.order.OutTradeNo,
                                            money: this.otherPrice - this.discountsPrice,
                                            notifyUrl: notify_url,
                                            payWay: this.payactive,
                                            businessId: webInfo.BusinessId,
                                            openId: openId,
                                        }
                                        uni.showLoading({
                                            title: "付款中..",
                                            mask: true,
                                        })
                                        that.fuiouAppPay(payParam)
                                    } else {
                                        that.Applogin();
                                    }

                                } else {
                                    let appidx = "?appIdx=1"
                                    let path =
                                        "pages_shop/packet/order/appGoMiniwaitPay?orderId=" +
                                        this.orderId +
                                        "&formapp=1&businessId=" +
                                        webInfo.BusinessId +
                                        "&payWay=" +
                                        this.payactive +
                                        "&discountsPrice=" + this.discountsPrice
                                    console.log(path)
                                    GetMiniAppId(appidx).then((rsp) => {
                                        console.log(rsp)
                                        if (rsp.State == 1) {
                                            if (rsp.Data.ChatId) {
                                                this.openMiniProgram(path, rsp.Data.ChatId)
                                            } else {
                                                this.openMiniProgram(path)
                                            }
                                            setTimeout(() => {
                                                uni.reLaunch({
                                                    url: "/pages/login/loading",
                                                })
                                                storage.setCache("miniProgram", true)
                                            }, 1000)
                                        } else {
                                            this.easyToast(rsp.Msg)
                                        }
                                    })
                                }
                                //#endif

                                //#ifdef MP-WEIXIN
                                let openId = storage.getCache("openId")
                                if (openId) {
                                    let notify_url = configs.baseUrl + "Notify/OrderPay/" + webInfo.BusinessId
                                    let tip = "订单支付"
                                    let payParam = {
                                        tip: tip,
                                        orderSn: this.order.Sn,
                                        paySn: this.order.OutTradeNo,
                                        money: this.order.PayMoney - this.discountsPrice,
                                        notifyUrl: notify_url,
                                        payWay: this.payactive,
                                        businessId: webInfo.BusinessId,
                                        openId: openId,
                                    }
                                    uni.showLoading({
                                        title: "付款中..",
                                        mask: true,
                                    })

                                    that.fuiouPay(payParam)
                                } else {
                                    this.$refs.authorizationTip.open()
                                }
                                //#endif
                            }
                        }
                    }
                } else {
                    this.easyToast(res.Msg)
                }
            })
            // Promise.all([p1]).then(ree => {
            //    if(this.stateStatus){
            // 		this.easyToast('订单已取消，无法支付')
            // 		return
            //    }else{

            //    }
            // })
        },
        synthesizepay(parms, noskip) {
            uni.showLoading({
                title: "支付中...",
            })
            if (parms.price > 0) {
                XianPayNew(parms).then((res) => {
                    uni.hideLoading()
                    if (res.State) {
                        if (noskip == 1 && this.otherPrice && this.payactive != 11) {
                            this.$refs.passwordBox.close()
                            if (this.otherPrice == 0) {
                                this.easyReLaunch("/pages_shop/packet/order/payResult?orderId=" + this.orderId)
                            }
                        } else {
                            this.easyReLaunch("/pages_shop/packet/order/payResult?orderId=" + this.orderId)
                        }
                    } else {
                        this.easyToast(res.Msg)
                    }
                })
            }
        },
        openMiniPay(payRes) {
            console.log("openMiniPay", payRes)
            var that = this
            //微信支付api1
            uni.requestPayment({
                provider: "wxpay",
                // appId:payRes.Data.appId,
                timeStamp: String(payRes.Data.timeStamp),
                nonceStr: payRes.Data.nonceStr,
                package: payRes.Data.package,
                signType: payRes.Data.signType,
                paySign: payRes.Data.paySign,
                success: function (res) {
                    console.log("支付成功", res)
                    uni.hideLoading()
                    that.easyReLaunch(
                        "/pages_shop/packet/order/payResult?orderId=" + that.orderId + "&formapp=" + that.formapp,
                    )
                },
                fail: function (err) {
                    console.log("支付失败", err)
                    uni.hideLoading()
                    // that.getOrderDetail()
                    that.goOrderPage()
                },
            })
        },
        wxpay(payParam) {
            var that = this
            let path = "?businessId=0"
            console.log("wxpay======")
            GetMiniAppPayData(payParam, path).then((payRes) => {
                if (payRes.State == 1) {
                    this.openMiniPay(payRes)
                } else {
                    this.easyToast(payRes.Msg)
                    setTimeout(() => {
                        uni.hideLoading()
                    }, 2000)
                }
            })
        },
        fuiouPay(payParam) {
            console.log("fuiouPay")
            var that = this
            let path = "?businessId=0"
            GetMiniAppPayData(payParam, path).then((payRes) => {
                console.log("payRes", payRes)
                console.log(that.payactive)
                if (payRes.State) {
                    if (that.payactive == 18) {
                        uni.navigateToMiniProgram({
                            appId: 'wx9f0f95c42bcf73c9',
                            path: 'pages/pay-plugin/pay-plugin?tradeNo=' + payRes.Data.appId + '&type=BF',
                            success(res) {
                                // 打开成功
                                that.easyReLaunch(
                                    "/pages_shop/packet/order/payResult?orderId=" + that.orderId + "&formapp=" + that.formapp,
                                )
                            }
                        })
                        uni.hideLoading()
                    } else if (that.payactive == 13 || that.payactive == 53) {
                        uni.hideLoading()
                        that.qcode = payRes.Data.url
                        that.url_base64 = payRes.Data.url_base64
                        setTimeout(() => {
                            that.$refs.qcodePopup.open()
                        }, 300)
                    } else {
                        this.openMiniPay(payRes)
                    }
                } else {
                    this.easyToast(payRes.Msg)
                    setTimeout(() => {
                        uni.hideLoading()
                    }, 2000)
                }
            })
        },
        fuiouAppPay(payParam) {
            console.log("fuiouAppPay")
            var that = this
            let path = "?businessId=0"
            GetMiniAppPayData(payParam, path).then((payRes) => {
                if (payRes.State) {
                    if (that.payactive == 18) {
                        let path = 'pages/pay-plugin/pay-plugin?tradeNo=' + payRes.Data.appId + '&type=BF';
                        that.openMiniProgram(path, 'gh_d3de2c52074f')
                        // that.openMiniProgram(path, 'gh_ed2c8a7644c7') // 惠销客
                        // that.openMiniProgram(path, 'gh_b1e637fff5ec') // 华商
                        uni.hideLoading()
                        setTimeout(() => {
                            that.easyReLaunch(
                                "/pages_shop/packet/order/payResult?orderId=" + that.orderId + "&formapp=" + that.formapp,
                            )
                        }, 3000)

                    }
                } else {
                    this.easyToast(payRes.Msg)
                    setTimeout(() => {
                        uni.hideLoading()
                    }, 2000)
                }
            })
        },
        helPayOrder(orderId) {
            helPayFn(this, orderId, 0).then((res) => {
                setTimeout(() => {
                    this.easyGoTo("/pages/order/index")
                    storage.setCache("miniProgram", true)
                }, 5000)
            })
        },
        getPayTypeIcon(item) {
            let type = item.PaymentPayWay
            return this.getPayIcon(type)
        },
        //App登录
        Applogin() {
            uni.getProvider({
                service: 'oauth',
                success: function (res) {
                    //支持微信、qq和微博等
                    if (res.provider.includes('weixin')) {
                        uni.login({
                            provider: 'weixin',
                            success: function (loginRes) {
                                // 获取用户信息
                                uni.getUserInfo({
                                    provider: 'weixin',
                                    success: function (infoRes) {
                                        let data = Object.assign(loginRes.authResult, infoRes);
                                        console.log(infoRes.userInfo.openId)
                                        console.log(data)
                                        storage.setCache("openId", infoRes.userInfo.openId)
                                    },
                                    fail: function (err) {
                                        uni.hideLoading();
                                        uni.showToast({
                                            icon: 'none',
                                            title: err
                                        })
                                    }
                                });
                            },
                            fail: function (err) {
                                uni.hideLoading();
                                uni.showToast({
                                    icon: 'none',
                                    title: err
                                })
                            }
                        })

                    }
                }
            })
        },
    },
}
</script>

<style lang="scss">
page {
    background: #f7f7f7 !important;
}

.container {
    background: #f7f7f7;

    .order-info {
        padding: $app-page-padding $app-page-padding 120rpx $app-page-padding;
    }
}

.result-status {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-bottom: 32rpx;
}

.success-icon {
    width: 108rpx;
    height: 108rpx;
    display: block;
    margin-right: 16rpx;
}

.tip {
    font-size: 28rpx;
    color: $color-gray-2;
    text-align: center;
}

.ought-price {
    background: #ffffff;
    border-radius: 24rpx;
    height: 224rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 24rpx;

    view {
        font-size: 80rpx;
        font-weight: bold;
        color: #000000;

        text {
            font-size: 48rpx;
        }
    }

    text {
        font-size: 28rpx;
        color: $color-gray-2;
    }
}

.balance {
    background: $color-white;
    margin-bottom: 34rpx;
    border-radius: 24rpx;
}

.balance-title {
    height: 98rpx;
    background: linear-gradient(270deg, #ffede9 0%, #fffbf9 100%);
    border-radius: 24rpx 24rpx 0px 0px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: #000000;
    font-size: 32rpx;
    font-weight: bold;

    image {
        width: 40rpx;
        height: 40rpx;
        margin: 0 22rpx 0 30rpx;
    }
}

.balance-body {
    background: #ffffff;
    height: 180rpx;
    display: flex;
    padding: 10rpx 24rpx;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    border-radius: 0px 0px 24rpx 24rpx;
}

.balance-body-check {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-input {
    view {
        font-size: 24rpx;
        color: $color-gray-2;
    }

    input {
        width: 230rpx;
        height: 60rpx;
        background: #f8f8f8;
        border-radius: 4rpx;
        border: 1rpx solid #000000;
        text-align: center;
        font-weight: bold;
        font-size: 36rpx;
    }

    .inputbox {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 230rpx;
        height: 60rpx;
        background: #f8f8f8;
        border-radius: 4rpx;
        border: 1rpx solid #000000;
        text-align: center;
        font-weight: bold;
        font-size: 36rpx;
        color: #000000;
    }
}

.checkmain {
    width: 32rpx;
    height: 32rpx;
    border: 1rpx solid rgba(0, 0, 0, 0.3);

    image {
        width: 32rpx;
        height: 32rpx;
        display: block;
    }
}

.checkbox-active {
    border-color: $app-color-main;
    background: $app-color-main;
}

.balance-title-Still {
    display: flex;
    flex-direction: column;
    height: 180rpx;
    padding-right: 24rpx;
    padding-top: 26rpx;
    padding-left: 30rpx;
    background: linear-gradient(270deg, #fff8ee 0%, #fffefc 100%);

    .balance-input {
        width: 100%;
    }
}

.no-change-price {
    height: 70rpx;
}

.still {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 36rpx;
}

.still-title {
    display: flex;

    image {
        margin-left: 0;
    }
}

.playlist {
    &>view {
        height: 112rpx;
        margin: 0 24rpx;
        display: flex;
        // justify-content: space-between;
        align-items: center;
        background: #ffffff;
        border-bottom: 1rpx solid #ebebeb;
    }

    &>view:last-child {
        border-bottom: none;
        border-radius: 0 0 24rpx 24rpx;
    }

    .playtype {
        padding-right: 16rpx;

        .pay-type-icon {
            width: 48rpx;
            height: 48rpx;
            margin-right: 12rpx;
        }

        .pay-type-name {
            flex: 1;
        }

        .radio {
            width: 38rpx;
            height: 38rpx;
            border: 2rpx solid rgba(0, 0, 0, 0.3);
            border-radius: 50%;
        }

        .active_radio {
            border-color: $app-color-main;
            display: flex;
            justify-content: center;
            align-items: center;

            text {
                width: 20rpx;
                height: 20rpx;
                border-radius: 50%;
                background: $app-color-main;
            }
        }
    }
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120rpx;
    display: flex;
    background: #ffffff;
    justify-content: center;
    align-items: center;
    padding-bottom: constant(safe-area-inset-bottom);
    /*兼容 IOS<11.2*/
    padding-bottom: env(safe-area-inset-bottom);

    /*兼容 IOS>11.2*/
    .btn {
        color: $color-white;
        background: $app-color-main;
        width: 690rpx;
        height: 90rpx;
        background: $app-color-main;
        border-radius: 45rpx;
        font-size: 32rpx;
    }

    .btn[disabled] {
        background: rgba($app-color-main, 0.4);
        color: #ffffff;
    }
}

.playlist-offline {
    &>view {
        border-bottom: none;
    }

    .offline-pay {
        border-radius: 4rpx;
        background: #fbfbfb;
        height: auto;
        display: flex;
        flex-direction: column;

        .offline-pay-item {
            width: calc(100% - 68rpx);
            display: flex;
            flex-direction: row;
            height: 112rpx;
            align-items: center;
            padding: 0 16rpx 0 52rpx;

            .pay-type-icon {
                width: 48rpx;
                height: 48rpx;
                margin-right: 12rpx;
            }

            .pay-type-name {
                flex: 1;
            }

            .radio {
                width: 38rpx;
                height: 38rpx;
                border: 2rpx solid rgba(0, 0, 0, 0.3);
                border-radius: 50%;
            }

            .active_radio {
                border-color: $app-color-main;
                display: flex;
                justify-content: center;
                align-items: center;

                text {
                    width: 20rpx;
                    height: 20rpx;
                    border-radius: 50%;
                    background: $app-color-main;
                }
            }
        }
    }

    padding-bottom: 24rpx;
}

.pop-return-box {
    background: $color-white;
    border-radius: $border-radius-10;
    padding: $app-page-padding;
    width: 600rpx;

    .pop-tip {
        text-align: center;
        padding: 60rpx 0;
        font-size: 32rpx;
        color: #999;
    }

    .pop-return-title {
        display: flex;
        justify-content: center;

        text {
            font-weight: 700;
            font-size: 34rpx;
        }
    }

    .pop-action {
        border-top: 1rpx solid rgba(0, 0, 0, 0.1);
        margin: 0 -24rpx -24rpx -24rpx;
        height: 110rpx;
        display: flex;
        align-items: center;
        justify-content: center;

        view {
            width: 50%;
            text-align: center;
            height: 110rpx;
            line-height: 110rpx;
            font-size: 34rpx;
            font-weight: bold;
            color: $app-color-main;
        }

        &>view:first-child {
            color: $color-gray-1;
            border-right: 1rpx solid rgba(0, 0, 0, 0.1);
        }
    }

    .return-msg {
        margin-bottom: 20rpx;

        .card-group-cell {
            margin-left: 0 !important;
        }
    }

    .img-title {
        display: flex;
        color: $app-color-text-tip;
        margin-bottom: 20rpx;
    }

    .action {
        display: flex;
        flex-direction: row;

        .btn {
            flex: 1;
            border-radius: $border-radius-10;
            height: 70rpx;

            &:first-child {
                margin-left: 0;
            }
        }
    }
}

.pay-type-discounts {
    height: 38rpx;
    background: rgba(236, 97, 42, 0.1);
    border-radius: 4rpx;
    font-size: 24rpx;
    color: #EC612A;
    padding: 2rpx 12rpx;
    margin-left: 16rpx;
}
</style>
